<template>
  <div class="customer-detail-box">
    <el-card class="box-card" style="margin-bottom:10px">
      <div slot="header" class="clearfix">
        <span>合同详情</span>
      </div>
      <el-row :gutter="20">
        <el-col :span="6">客户姓名：{{ form.name }}</el-col>
        <el-col :span="6">购买学科：{{ form.subject }}</el-col>
        <el-col :span="6">购买课程：{{ form.courseName }}</el-col>
        <el-col :span="6">购买金额：{{ form.order }}</el-col>
      </el-row>
      <el-row :gutter="20">
        <el-col :span="6">是否折扣：{{(form.discountType&&form.discountType!=='无')?'是':'否' }}</el-col>
        <el-col :span="6">创建时间：{{ form.createTime }}</el-col>
        <el-col :span="6">折扣类型：{{ form.discountType }}</el-col>
      </el-row>
    </el-card>
  </div>
</template>

<script>
export default {
  data () {
    return {
      // 详情数据
      form: {}
    }
  },
  created () {
    //查询线索信息
    this.getInfo(this.$route.query.id)
  },
  methods: {
    //查询线索详情
    getInfo (id) {
      this.$axios.get("/api/tb/contract/view/"+id)
        .then((res) => {
          if (res.data.code == 200) {
            this.form = res.data.data
          } else {
            this.$message.error(res.data.msg);
          }
        })
    },
    // 回显数据字典
    selectDictLabel(datas, value) {
      var actions = [];
      Object.keys(datas).some((key) => {
        if (datas[key].dictValue == ('' + value)) {
          actions.push(datas[key].dictLabel);
          return true;
        }
      })
      return actions.join('');
    },
    // 意向学科字典翻译
    subjectFormat (val) {
      return this.selectDictLabel(this.subjectOptions, val)
    },
    //查询数据字典
    getDicList () {
      this.$axios.get("/api/sys/dictData/optionselect/course_subject")
        .then((res) => {
          if (res.data.code == 200) {
            this.subjectOptions = res.data.data;
          } else {
            this.$message.error(res.data.msg);
          }
        })
    },
  }
}
</script>
<style scoped>
   .el-row {
    margin-bottom: 20px;
    &:last-child {
      margin-bottom: 0;
    }
  }
</style>
